<?php
/**
 * ============================================================================
 * 版权所有 2008-2011 多多网络，并保留所有权利。
 * 网站地址: http://soft.duoduo123.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
*/
session_start();
error_reporting(0);
include_once 'comm/config.php';
include_once 'comm/checkpostandget.php';
include_once 'comm/page.class.php';

function sjc($stime,$etime){
	$stime=strtotime($stime);
	$etime=strtotime($etime);
	$day = round(($etime-$stime)/3600/24) ;
	if($day>0) return '还有<b style=" color:red">'.$day.'</b>天过期';
	else return '已经过期';
}

$sj=date('Y-m-d');
$page = !($_GET['page'])?'1':intval($_GET['page']);
$pagesize=10;
$frmnum=($page-1)*$pagesize;

$mall_id=(int)$_GET['id'];
$act=$_GET['act']?$_GET['act']:'fxsm';
if($mall_id!=""){
	//查找店铺数据库
	$sql="select * from ".$BIAOTOU."mall where id='".$mall_id."'";
	$rs=mysql_query($sql);
	$mall=mysql_fetch_array($rs);
}

if($act=='fxsm'){
    $sql="select count(*) as totalnum from ".$BIAOTOU."mall_comment where `mall_id` = '$mall_id'";
    $rsnum = mysql_query($sql);
    $rownum = mysql_fetch_array($rsnum);
    $mall_comment_total=$rownum["totalnum"];

    $sql="select * from ".$BIAOTOU."mall_comment where `mall_id` = '$mall_id' order by id desc limit $frmnum,$pagesize";
    $rs=mysql_query($sql);
}

if($act=='cxyh'){
	$sql="select count(*) as totalnum from ".$BIAOTOU."mall_comment where `mall_id` = '$mall_id'";
    $rsnum = mysql_query($sql);
    $rownum = mysql_fetch_array($rsnum);
    $mall_comment_total=$rownum["totalnum"];
	
    $sql="select count(*) as totalnum from ".$BIAOTOU."activity where mallid=$mall_id and etime>'$sj'";
	$rsnum = mysql_query($sql);
    $rownum = mysql_fetch_array($rsnum);
    $total=$rownum["totalnum"];
	
	$sql="select * from ".$BIAOTOU."activity where mallid=$mall_id and etime>'$sj' order by sort desc, id desc limit $frmnum,$pagesize";
	$query=mysql_query($sql);
	while($row=mysql_fetch_array($query)){
	    $activity[]=$row;
	}
}

$comment_nums = $mall_comment_total;

$sql="select sum(fen) from ".$BIAOTOU."mall_comment where mall_id='".$mall_id."'";
$query = mysql_query($sql);
$row = mysql_fetch_array($query);
$zong_fen=$row['0'];

//获取当前商城的类型
$sql="select typename from ".$BIAOTOU."malltype where typecode=".$mall["catid"];
$res=mysql_query($sql);
$row=mysql_fetch_array($res);
$malltype=$row["typename"];

$pjf=number_format($zong_fen/$comment_nums,1);

$fen=round($zong_fen/$comment_nums,2);
$x=25.2*$fen;
$tag='malllist';
$pagetag="mall";
include_once 'comm/seo.php';
include_once 'comm/wjt.php';
//引入模版文件
include 'template/'.MOBAN.'/mall.tpl.php';
mysql_close($cfg_link);
?>